function FirstAssistant() {
}

FirstAssistant.prototype.setup = function() {
	var currentTime = new Date();
	var month = currentTime.getMonth() + 1;
	var day = currentTime.getDate();
	var year = currentTime.getFullYear();

	//displays the date
	this.date=(month + "/" + day + "/" + year);
	this.controller.get('divIdcount').update(this.date);

	//set up the clock in buttons
	this.buttonAttributes = {};

	this.InbuttonModel = {
		buttonLabel : 'CLOCK IN',
		buttonClass : '',
		disabled : false
	};

	this.controller.setupWidget("IN", this.buttonAttributes, this.InbuttonModel);
	Mojo.Event.listen(this.controller.get('IN'), Mojo.Event.tap, this.handleButtonPress.bind(this));

	//set up the clock out buttons
	this.OutbuttonAttributes = {};

	this.OutbuttonModel = {
		buttonLabel : 'CLOCK OUT',
		buttonClass : '',
		disabled : false
	};

	this.controller.setupWidget("OUT", this.buttonAttributes, this.OutbuttonModel);
	Mojo.Event.listen(this.controller.get('OUT'), Mojo.Event.tap, this.handleOutButtonPress.bind(this));
};

//i learned you only need one setup function

//BUT!! I need to have a action function for each button

//Here is where we define the clock in buttons actions
FirstAssistant.prototype.handleButtonPress = function(event){
	// Get the time!
	var currentTime = new Date();
	var hours = currentTime.getHours();
	var minutes = currentTime.getMinutes();


		if (minutes < 10){
			minutes = "0" + minutes;
		}
			this.time = (hours + ":" + minutes + " ");
			this.startTime= currentTime;
		if(hours > 11){
			this.time = (this.time + ("PM"));
		} else {
			this.time = (this.time + ("AM"));
		}
		this.controller.get('divIdtime').update(this.time);
};

// here is where we prepare for the clock out buttons action
FirstAssistant.prototype.handleOutButtonPress = function(event){

	//Get New time!

	var ellapsedTime = new Date();
	var ehours = ellapsedTime.getHours();
	var eminutes = ellapsedTime.getMinutes();

	//use try-catch-blocks to aid in debugging
	try{
		if (eminutes < 10){
			//if the elapsed minutes is less the 10 add a 0 in front of itself.
			eminutes = "0" + eminutes;
		}
			this.OUTtime = (ehours + ":" + eminutes + " ");
		if(ehours > 11){
			//if OUTtime is greater than 11 add PM to the end
			this.OUTtime = (this.OUTtime + ("PM"));
		} else {
			//otherwise add AM.
			this.OUTtime = (this.OUTtime + ("AM"));
		}

		this.timeDif = (this.startTime - ellapsedTime);
	}catch (error){
			Mojo.Log.error("out button error: "+error);
		}
		this.controller.get('divIdOuttime').update(this.OUTtime);

	//Need to figure out how to get a diff.
	this.controller.get('divIdDiftime').update(this.timeDif);
};